<?php 
ob_start();
//if (isset($_COOKIE["mywishlist"]))
//  {echo "Cookiee " . $_COOKIE["mywishlist"] ;
 // } 
//echo $HTTP_COOKIE_VARS["mywishlist"];
//echo $_COOKIE[0];

//print_r(array_count_values($_COOKIE));
$timefilter = $_GET['timefilter'];
$wishlist= NULL;
$datelist = NULL;
$flag = 0;
$count = 0;
if(isset($_GET['productId'])){
$productId=$_GET['productId'];
}
if(!isset($productId)){
	if(isset($_COOKIE['mywishlist'])){
		$wishlist = $_COOKIE['mywishlist'];
		$datelist = $_COOKIE['mydatelist'];
	}
}else {
	if (isset($_COOKIE['mywishlist'])){
		$wishlist = $_COOKIE['mywishlist'];
		$datelist = $_COOKIE['mydatelist'];
		$products = explode(',',$wishlist);
		$dates = explode(',',$datelist);
		foreach ($products as $value) {
			if($value == $productId){
				$flag=1;
				$dates[$count] = date("y-m-d");
				break;
			}
			$count++;
		}
		if($flag == 0){
			$wishlist = $wishlist.','.$productId;
			$datelist = $datelist.','.date("y-m-d");
		}else{
			$count = 0;
			foreach ($dates as $value) {
				if($count == 0){
					$count=1;
					$datelist = $value;
				}else{
					$datelist = $datelist.','.$value;
				}
			}
		}
		}else{
			$wishlist = ''; 
			$wishlist=$productId;
			$datelist =date("y-m-d");
		}
		
	setcookie("mywishlist",$wishlist,time()+60*60*24*30*3,"/");
	setcookie("mydatelist",$datelist,time()+60*60*24*30*3,"/");

}

if(isset($wishlist)){
$products = explode(',',$wishlist);
$dates = explode(',',$datelist);
}

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Merchandise :: Hambaa.com</title>
<link rel="stylesheet" type="text/css" href="styles/Graphitti_style.css" />
<link rel="stylesheet" type="text/css" href="styles/Cart.css" />
<link rel="stylesheet" type="text/css" href="styles/Gallery_details.css" />
<script type="text/javascript" src="javascript/cart.js"></script>
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/JavaScript">
$(document).ready(function() {
	$('#gallery li').hover(
		function(){$('span',this).slideToggle('medium');},
		function(){$('span',this).slideToggle('medium');
     });
});

</script>


</head>

<body onload="setOrderCount();">
<table id="headertable" border="0" align="center" width="950" height="118"  >
<tr >
<td height="114" align="right" valign="bottom">
<a href="index.php"><img src="images/logopng.png" width="103" height="99" /></a></td>
<td align="left" valign="top">
<a href="index.php"><img src="images/hambaa_logo_newjpg.jpg" width="308" height="107" /></a>
</td>
<td valign="top" align="right">
    <table id="containertable" cellpadding="0" cellspacing="0" border="0">
    <tr>
    <td align="right">
        <div id="menulinks">
        <a href="index.php" class="active">Home</a>
        <a href="offers.php">Offers</a>
        <a href="about_us.php">About Us</a>
        <a href="contact_us.php">Contact Us</a>
        </div>
    </td>
    </tr>
    </table></td>
</tr>
</table>


<table id="hotitem_cart" border="0" width="950"  align="center" bgcolor="#FFFFFF" >
<tr>
<td width="8"></td>
<td width="356">
Order for your tshirt from our wide range.<br>
What's better, now you can create your own design! 
</td>
<td width="164"><img src="images/hot_items.png" width="164" height="61" /></td>
<td width="55">
        <img src="images/tshirts/ts1.jpg" height="55" width="55" />
</td>
        <td width="55">
        <img src="images/tshirts/ts2.jpg" height="55" width="55" />
        </td>
        <td width="55">
        <img src="images/tshirts/ts3.jpg" height="55" width="55" />
        </td>
         <td width="55">
        <img src="images/tshirts/ts4.jpg" height="55" width="55"  />
        </td>	

<td  align="right" width="150" >

<a href = "javascript:void(0)" class="cartbtn" onclick = "document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block';getShoppingCart()"><table border="0" ><tr><td><img src="images/shopping_cart1.png" width="41" height="41" /></td>
<td>Cart(<span  id="order_count"></span>)</td></tr></table></a>

<div id="light" class="white_content" >
        <div id="close_button" style="position:fixed;width:inherit;float:right" >
        <a href = "javascript:void(0)" onclick = "document.getElementById('light').style.display='none';document.getElementById('fade').style.display='none'"   ><img src="images/Close-button.png"  /></a>
        </div>   
 		<div id="table_container" style="overflow:auto" >
			<!--table created here-->             
        </div>
    </div>

	<div id="fade" class="black_overlay" onclick = "document.getElementById('light').style.display='none';document.getElementById('fade').style.display='none'" />
    
</td>
</tr>

</table>







<table id="outertable" border="0" width="950" height="269" align="center" bgcolor="#FFFFFF" >

<tr >
<td  width="139" valign="top">

    <table id="time_filter"  cellpadding="10">
    <tr><td>
    <span style="background-color:#0099CC;  padding:5px">
        <a href="mywishlist.php?timefilter=today"> added today </a></span>
    </td></tr>
    <tr><td>
    <span style="background-color:#0099CC;  padding:5px">
        <a href ="mywishlist.php?timefilter=recent"> added recently </a></span>
    </td></tr>    
    <tr><td>
    <span style="background-color:#0099CC;  padding:5px">
        <a href ="mywishlist.php?timefilter=older"> older </a></span>
    </td></tr>
    <tr><td>
    <span style="background-color:#0099CC;  padding:5px">
        <a href ="mywishlist.php?timefilter=all"> show all </a></span>
    </td></tr>
	<tr>
	<td>
	
	</td>
	</tr>
    </table>    
</td>

<td width="588" valign="top" >

<table  border="0" cellpadding="0"  >
<tr ><td>
		
    <ul id="gallery">

	<?php
	$count = 0;
	if(isset($products)){
	foreach ($products as $productId) {
		$date1 = $dates[$count];//reading date array from cookie
		$date2 = date("y-m-d");//current date
		
		$ts1 = strtotime($date1);
		$ts2 = strtotime($date2);
		
		$seconds_diff = $ts2 - $ts1;
		$days_diff=floor($seconds_diff/3600/24);
		if($timefilter=='today')
			{
			//echo $timefilter;
			if($days_diff==0)
				{
		
				?>
				<li>
				<a href="details.php?productId=<?php echo $productId; ?>" > 
				<img  src="images/tshirts/ts<?php echo $productId; ?>.jpg" width="180" height="180"  />
				</a>
				<span  style="color:#FFF;   font-size:13px;  font-family:Tahoma, Geneva, sans-serif">
				Added on <?php echo $dates[$count]; ?>
				<br />product id <?php echo $productId; ?>
				<br />today-addday=<?php echo $days_diff; ?>
				
				</span>
				</li>
				<?php
				}
			}
		else if($timefilter=='recent')
			{
			//echo $timefilter;
			if($days_diff>0 && $days_diff<=15)
				{
				?>
				<li>
				<a href="details.php?productId=<?php echo $productId; ?>" > 
				<img  src="images/tshirts/ts<?php echo $productId; ?>.jpg" width="180" height="180"  />
				</a>
				<span  style="color:#FFF;   font-size:13px;  font-family:Tahoma, Geneva, sans-serif">
				Added on <?php echo $dates[$count]; ?>
				<br />product id <?php echo $productId; ?>
				<br />today-addday=<?php echo $days_diff; ?>
				
				</span>
				</li>		
				<?php
				}
			}
		else if($timefilter=='older')
			{
			//echo $timefilter;
			if($days_diff>15 && $days_diff<=60)
				{
				?>
				<li>
				<a href="details.php?productId=<?php echo $productId; ?>" > 
				<img  src="images/tshirts/ts<?php echo $productId; ?>.jpg" width="180" height="180"  />
				</a>
				<span  style="color:#FFF;   font-size:13px;  font-family:Tahoma, Geneva, sans-serif">
				Added on <?php echo $dates[$count]; ?>
				<br />product id <?php echo $productId; ?>
				<br />today-addday=<?php echo $days_diff; ?>
				
				</span>
				</li>		
				<?php
				}
			}
		else if($timefilter=='all')
			{
			//echo $timefilter;
			{			
			$date1=$dates[$count];
					
			//$date1=$dates[$count];
				?>
				<li>
				<a href="details.php?productId=<?php echo $productId; ?>" > 
				<img  src="images/tshirts/ts<?php echo $productId; ?>.jpg" width="180" height="180"  />
				</a>
				<span  style="color:#FFF;   font-size:13px;  font-family:Tahoma, Geneva, sans-serif">
				Added on <?php echo $date1; ?>
				<br />product id <?php echo $productId; ?>
				<br />today-addday=<?php echo $days_diff; ?>
				
				</span>
				</li>		
				<?php
				}
			}
			
	$count++;	
	}
	}
	?>
          	
    </ul>

</td></tr>
</table>

</td>

<td width="201" valign="top">
		<table id="innerright" border="0" cellspacing="2"  width="200" align="right" background="images/tableback3.png" >
		<tr><td height="176"><h3>Recommended for you</h3></td></tr>
 		    
       <tr><td align="center" bgcolor="#FFFFFF" valign="middle">
    <br><br>
    </td></tr>
    
    <tr><td height="27" bgcolor="#FF6666">

    <h6>We'd like to hear from you</h6>
    </td></tr>

	<tr align="center" height="27"><td align="center"> 
    <h2><a href="suggest.php">Make your Suggestion</a></h2>
    
    </td></tr>
  
   
    </table>

</td>

</tr>
</table>



<br>

<div id="footer" > 


<table border="0" width="952" height=154 align="center" >
<tr>
<td >
<h1>My Hambaa</h1>
</td>
<td >
<h1>Shopping Policies</h1>
</td>
<td >
<h1>Payment Information</h1>
</td>
<td >
<h1>Contact Us</h1>
</td>
</tr>

<tr>
<td>
<a href = "javascript:void(0)" onclick = "document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block';getShoppingCart()">My Cart</a> |
<a href="about_us.php">My Order</a> |
<a href="about_us.php">FAQs</a>
</td>

<td >
<a href="about_us.php">Return Policy</a> |
<a href="about_us.php">Refund Policy</a> |
<a href="about_us.php">Terms and Conditions</a>
</td>

<td >
<a href="about_us.php">Payment Options: </a>COD
</td>

<td >
e-mail:
<a href="mailto:care@hambaa.com">care@hambaa.com</a>
</td>
</tr>

<tr align="center"><td colspan="4">
<hr />

&copy;2012 All Rights Reserved by <a href="index.php">www.hambaa.com</a>
</td></tr>
</table>
</div>
</body>
</html>
<?php 
ob_end_flush();
?>

